import clickhouse_connect


class ClickhouseUtil:
    def __init__(self):
        self.client = clickhouse_connect.get_client(host='172.29.7.210', port=2666, username='default',
                                                    password='jdigs123')

    def get_data_from_clickhouse(self, query):
        return self.client.query(query).result_rows

    def write_data(self, table_name, data, column_names, database_name):
        self.client.insert(table_name, data, column_names, database_name)


